Skip to content

UN-3636 [MISC] Make the rig unit/integration CI job green on main#2115

Merged
chandrasekharan-zipstack merged 36 commits into
mainfrom
fix/test-rig-green-v2
Jul 8, 2026
Merged

UN-3636 [MISC] Make the rig unit/integration CI job green on main#2115
chandrasekharan-zipstack merged 36 commits into
mainfrom
fix/test-rig-green-v2

Conversation

@chandrasekharan-zipstack

@chandrasekharan-zipstack chandrasekharan-zipstack commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What

Make the rig's unit/integration CI job (.github/workflows/ci-test.yaml) a reliable, green, parallel check — the groundwork for making it a required PR merge gate (UN-3635). Checklist item #1 of UN-3636.

Why

The job had never passed on main: --fail-on-critical-gap failed the build on every uncovered critical path, including paths only coverable by tiers that didn't run. Beyond that, backend test selection was hand-listed, several test files were dead or never collected, and the two tiers ran serially.

How

Gating

  • Critical-path gaps split into in-scope (a covering group ran in this tier and wasn't green → gates) vs out-of-scope (coverage lives in an unrun tier or is undeclared → warn-only). Regression detection (baseline-covered path losing coverage) is unchanged and always gates.
  • --fail-on-critical-gap now runs on PRs and main: main is gap-free and PRs test the merge ref, so a PR gap failure can only be self-introduced.
  • Coverage attestation requires a covering group with status == "pass" — a group that collected zero tests ("empty", pytest exit 5) stays non-failing but no longer proves coverage.
  • New per-path proof: marker in tests/critical_paths.yaml: on top of a green covering group, the path needs ≥1 passing test carrying @pytest.mark.critical_path("<id>") in that build (tests may stack several markers). A rig-injected pytest plugin copies marker args into junit testcase properties; the rig reads back only passing testcases, and unknown marker ids fail the run. adapter-register-llm is flipped to proof: marker; the rest stay proof: group until their tests are backfilled and marked.

Test selection & hygiene

  • backend/conftest.py auto-marks DB-bound tests (TestCase/TransactionTestCase/django_db) as integration; unit-backend and integration-backend are exact complements over paths: ["."] — no hand-kept lists.
  • python_files standardized across backend/workers/sdk1/connectors: test_*.py, *_test.py, *_tests.py, plus Django's per-app tests.py — which surfaced 28 real, passing tests (tenant_account_v2, account_v2) that were never being collected.
  • Rewrote 2 fragile test modules that stubbed sys.modules (broke under whole-tree collection with Django loaded) to mock.patch on real modules: api_v2/tests/test_deployment_helper.py, prompt_studio_core_v2/tests/test_build_index_payload.py.
  • New integration API test for adapter-register-llm (adapter_processor_v2/tests/test_adapter_api.py) — drives POST /api/v1/adapter/ end-to-end, marked @pytest.mark.critical_path("adapter-register-llm").
  • Deleted dead/unrunnable tests: core test_pandora_account.py + test_pubsub_helper.py, platform-service test_auth_middleware.py, connector_v2 tests (v1-era fixtures, never collected), the redundant no-flask guard test, and the uncollectable unit-tool-registry group. Live-DB connector smoke tests (skip-without-creds) were deleted as superseded by the backend DB-writer tests; per review, the two mock-only ones (test_bigquery_db.py, test_mariadb.py) are restored — they were the only coverage of those connectors' error mapping.
  • test_insert_into_db_with_error_postgresql restored as strict xfail: it exercises a real latent bug (data=None serialized as the literal string 'None', invalid for the jsonb column) — kept red-but-expected in CI instead of deleted, flips loudly when the bug is fixed.
  • tests/README.md: contributor guide — filename patterns, tier inference, seeding/mocking rules, local run commands.

CI workflow

  • Path filtering moved from trigger to job level so a skipped run still reports a check (required-check compatible); no base-branch filter, so stacked PRs run tests too. A failed changes job now turns report red instead of green-skipping the whole chain.
  • Unit and integration tiers run as parallel matrix jobs (~6m20s → ~4m50s); a report job aggregates reports, unions coverage, posts the PR comment, and propagates tier failures — making it suitable as the single required check.
  • Baseline writes centralized: tier jobs restore the baseline read-only; report combine --update-baseline (new rig flag) is the sole writer, on green main builds only.

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

No. Changes are confined to the test rig, CI workflow, and test files — no production/runtime code. Gate changes only relax out-of-tier failure conditions; real in-tier coverage regressions still fail.

Database Migrations

  • None.

Env Config

  • None.

Relevant Docs

  • tests/README.md, tests/rig/

Related Issues or PRs

Dependencies Versions

  • None.

Notes on Testing

  • CI green on this branch with the final shape: test (unit) + test (integration) in parallel, report aggregating.
  • Locally (testcontainers Postgres/Redis): unit-backend 118 passed; integration-backend 52 passed, 26 skipped, 1 xfailed (skips = destination-connector engine tests gated on external credentials) with adapter-register-llm attested via the junit marker property; unit-connectors 63 passed; rig self-tests 64 passed; rig validate OK (15 groups, 9 critical paths).

Deferred (separate PRs under UN-3636):

  • Credential-gated group for the 8 endpoint_v2/tests/destination-connectors/ engine suites (skip-without-creds today).
  • unit-workers marker fix (collects 0 tests).

Screenshots

Checklist

I have read and understood the Contribution Guidelines.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Critical-path status tracking now records scope, the rig and manifest configuration were updated, and --fail-on-critical-gap treats in-scope and out-of-scope gaps differently. Backend helpers and connector tests were also adjusted for the new integration setup.

Changes

Critical-path scope gating

Layer / File(s) Summary
Scope metadata and group manifest
tests/rig/critical_paths.py, tests/critical_paths.yaml, tests/groups.yaml, pyproject.toml, tests/rig/runtime.py, tests/rig/critical_paths.py, tests/rig/tests/test_critical_paths.py
CriticalPathStatus stores scope, registry and group manifests redefine coverage and selectable groups, and the evaluator/tests assert the new scope flag behavior.
CLI runtime and infra wiring
tests/rig/cli.py, tests/rig/runtime.py, tests/rig/tests/test_cli.py
cmd_run now separates in-scope and out-of-scope gaps, provisions services-only infra when needed, and maps Postgres/MinIO endpoints into the test environment.
Backend and connector test updates
backend/dashboard_metrics/tests/test_tasks.py, backend/prompt_studio/prompt_studio_core_v2/tests/test_build_index_payload.py, backend/usage_v2/tests/test_helper.py, backend/pyproject.toml, backend/utils/file_storage/helpers/prompt_studio_file_helper.py, unstract/connectors/pyproject.toml, unstract/connectors/tests/databases/*, unstract/connectors/tests/filesystems/*
Backend test fixtures now use organization-backed records and safer module isolation, while connector tests switch to integration markers, environment-driven credentials, and conditional skips.
Obsolete unit test cleanup
tox.ini, unstract/core/tests/account_services/test_pandora_account.py, unstract/core/tests/test_pubsub_helper.py
Legacy unit test entrypoints and entire unit test modules were removed from the tree.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 53.19% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise and clearly matches the main change: making the rig CI job green on main.
Description check ✅ Passed The PR description follows the template and fills the required sections with enough detail about what changed, why, how, risks, and testing.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/test-rig-green-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes the rig's unit/integration CI job reliably green by fixing test selection, parallelising tiers, and tightening critical-path attestation \u2014 groundwork for making it a required PR merge gate.

  • Critical-path gating: gaps split into in-scope (declared covering group ran red \u2192 gates) vs out-of-scope (unrun tier or undeclared \u2192 warn-only); proof: marker mode adds per-test attestation via a new pytest plugin that writes critical_path junit properties; _coverage_attesting_groups now excludes empty (exit-5) groups from coverage claims.
  • Test selection & hygiene: backend/conftest.py auto-marks DB-bound tests integration via pytest_collection_modifyitems; unit-backend/integration-backend use paths: [\".\"] with marker filters instead of hand-kept lists; 2 fragile sys.modules-stubbing test modules rewrote to mock.patch; dead/unrunnable tests deleted; test_insert_into_db_with_error_postgresql marked strict xfail to document a real latent jsonb bug.
  • CI workflow: path filtering moved to job level for required-check compatibility; unit and integration tiers run as parallel matrix legs (~4m50s); a single report job aggregates results, posts PR comment, updates baseline (main only), and propagates tier failures as the required check.

Confidence Score: 4/5

Safe to merge for changes confined to tests and CI — no production code touched — but the path-filter change in the CI workflow has an unintended behavioral difference worth correcting first.

The rig logic, marker attestation, and test rewrites are well-designed and thoroughly tested. The one concrete defect is in the CI workflow: predicate-quantifier: every with negated-only patterns skips the entire test run whenever any changed file falls inside an ignored directory (docker/, frontend/, docs/), even when other changed files are in backend/. A PR that simultaneously patches backend code and updates a Dockerfile would have CI silently skipped rather than run, defeating the purpose of the required-check gate this PR is building toward.

.github/workflows/ci-test.yaml — the predicate-quantifier: every setting on the paths-filter step.

Important Files Changed

Filename Overview
.github/workflows/ci-test.yaml Refactored path filtering from trigger-level to job-level using dorny/paths-filter with predicate-quantifier: every; splits tiers into a parallel matrix; adds a report aggregation job as the single required check gate. The every quantifier causes CI to skip for PRs that touch both ignored dirs (docker/frontend/docs) and backend code simultaneously — a behavioral regression from the original paths-ignore.
tests/rig/cli.py Adds --update-baseline to report combine, _coverage_attesting_groups (excludes empty/exit-5 groups), _marker_proven_paths, _db_env_from_postgres_url, _inject_infra_env, and TestcontainersRuntime provisioning for requires_services groups. Logic for in-scope vs out-of-scope gap gating is correct and well-tested.
tests/rig/critical_paths.py Adds proof: marker field to CriticalPath, in_scope flag (now defaulting False) to CriticalPathStatus, and extracts _status_for/_gap_note helpers. Logic is correct: marker-proof paths require both a green covering group AND a passing marked test; in-scope vs out-of-scope gap classification is accurate.
tests/rig/reporting.py Adds passed_critical_path_ids which reads junit XML to find critical-path ids attested by passing tests only. Minor: prop.get("value") is called twice (guard + add), causing a type-annotation mismatch a checker would flag.
tests/rig/pytest_plugin/rig_critical_path.py New pytest plugin that copies @pytest.mark.critical_path marker args into junit testcase properties at collection time. Stdlib-only, isolated in its own directory to avoid PYTHONPATH collisions. Logic is correct for the junit-property attestation flow.
backend/conftest.py Adds central pytest_collection_modifyitems hook that auto-marks all Django TestCase/TransactionTestCase and django_db tests as integration, eliminating hand-maintained per-file markers and enabling exact unit/integration tier split.
tests/groups.yaml Replaces hand-listed paths with paths: ["."] + marker-based selection for backend groups; adds integration-backend (DB-backed) and integration-connectors (MinIO-backed); removes unit-runner and unit-tool-registry dead groups.
tests/critical_paths.yaml Wires adapter-register-llm to integration-backend with proof:marker; removes tool-sandbox-exec (unit-runner deleted). All other paths retain proof:group with existing covered_by mappings.
backend/adapter_processor_v2/tests/test_adapter_api.py New integration test that drives POST /api/v1/adapter/ end-to-end with only the SDK context-window call mocked; correctly marked critical_path("adapter-register-llm"). Auto-detected as integration via conftest hook due to TestCase subclassing.
backend/workflow_manager/endpoint_v2/tests/destination-connectors/test_destination_connector_postgres.py Adds xfail marker to test_insert_into_db_with_error_postgresql documenting the real latent jsonb bug (data=None serialized as literal string 'None'); fixes schema and table-name casing issues.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant GH as GitHub push/PR
    participant CH as changes job
    participant TU as test (unit) job
    participant TI as test (integration) job
    participant RP as report job
    participant CA as actions/cache

    GH->>CH: trigger
    CH->>CH: dorny/paths-filter (every, negated globs)
    CH-->>TU: "relevant=true schedule"
    CH-->>TI: "relevant=true schedule"
    TU->>TU: tox -e unit -- --fail-on-critical-gap
    TI->>TI: tox -e integration -- --fail-on-critical-gap
    TU->>TU: suffix .coverage to .coverage.tier-unit
    TI->>TI: suffix .coverage to .coverage.tier-integration
    TU-->>RP: upload artifact reports-unit
    TI-->>RP: upload artifact reports-integration
    RP->>CA: restore previous-summary.json (read-only)
    RP->>RP: download-artifact merge-multiple
    RP->>RP: tox -e rig -- report combine optional update-baseline
    RP->>CA: save updated baseline (main only)
    RP->>GH: sticky PR comment (combined report)
    RP->>RP: "needs.test.result == success or exit 1"
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant GH as GitHub push/PR
    participant CH as changes job
    participant TU as test (unit) job
    participant TI as test (integration) job
    participant RP as report job
    participant CA as actions/cache

    GH->>CH: trigger
    CH->>CH: dorny/paths-filter (every, negated globs)
    CH-->>TU: "relevant=true schedule"
    CH-->>TI: "relevant=true schedule"
    TU->>TU: tox -e unit -- --fail-on-critical-gap
    TI->>TI: tox -e integration -- --fail-on-critical-gap
    TU->>TU: suffix .coverage to .coverage.tier-unit
    TI->>TI: suffix .coverage to .coverage.tier-integration
    TU-->>RP: upload artifact reports-unit
    TI-->>RP: upload artifact reports-integration
    RP->>CA: restore previous-summary.json (read-only)
    RP->>RP: download-artifact merge-multiple
    RP->>RP: tox -e rig -- report combine optional update-baseline
    RP->>CA: save updated baseline (main only)
    RP->>GH: sticky PR comment (combined report)
    RP->>RP: "needs.test.result == success or exit 1"
Loading

Reviews (21): Last reviewed commit: "refactor: address SonarCloud issues on r..." | Re-trigger Greptile

@chandrasekharan-zipstack chandrasekharan-zipstack changed the title UN-3632 [FIX] Scope rig --fail-on-critical-gap to in-tier coverage so main runs green UN-3632 [MISC] Scope rig --fail-on-critical-gap to in-tier coverage so main runs green Jun 25, 2026
Comment thread tests/rig/critical_paths.py Outdated
@chandrasekharan-zipstack chandrasekharan-zipstack changed the title UN-3632 [MISC] Scope rig --fail-on-critical-gap to in-tier coverage so main runs green UN-3636 [FIX] Scope rig --fail-on-critical-gap to in-tier coverage so main runs green Jun 26, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/critical_paths.yaml`:
- Around line 57-63: Keep `tool-sandbox-exec` active in
`tests/critical_paths.yaml` until the runner/tool-registry flow is fully
removed; the current commented-out entry is excluded from `evaluate()`, so
restore the `tool-sandbox-exec` item in place with `covered_by: []` and keep its
`entry`/`description` intact so the warn-only path still reports the gap.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 247fbb34-d0f1-417c-97a5-76915cbe3c0f

📥 Commits

Reviewing files that changed from the base of the PR and between a92eb0c and 63e53ff.

📒 Files selected for processing (2)
  • tests/critical_paths.yaml
  • tests/groups.yaml

Comment thread tests/critical_paths.yaml Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (1)
unstract/connectors/tests/filesystems/test_sharepoint_fs.py (1)

118-122: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Encode the current schema contract instead of skipping it.

If is_personal is intentionally not part of the JSON schema, please assert that explicitly here rather than disabling the test. Leaving it skipped means accidental schema drift in either direction will pass unnoticed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@unstract/connectors/tests/filesystems/test_sharepoint_fs.py` around lines 118
- 122, The SharePoint filesystem test is skipped instead of asserting the
intended schema contract, so replace the skip in test_sharepoint_fs.py with an
explicit assertion in the relevant test around is_personal/json_schema.json
behavior. Use the existing SharePoint filesystem test class and helpers to
verify that is_personal is intentionally absent from the JSON schema (and that
personal/site is inferred from site_url), so future schema drift is caught by
the test instead of being ignored.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@backend/prompt_studio/prompt_studio_core_v2/tests/test_build_index_payload.py`:
- Around line 86-96: The module restore helper currently clears only the saved
collaborator stubs, but it also needs to evict prompt_studio_helper from
sys.modules so later imports reload it with real dependencies. Update
_restore_modules in test_build_index_payload.py to pop the prompt_studio_helper
module entry after _psh_mod has already been bound, and make sure the same
cleanup is applied wherever the tests reset module state (including the later
restore block referenced in the comment).

In `@backend/usage_v2/tests/test_helper.py`:
- Around line 20-30: Avoid the module-level reassignment of the Usage symbol in
test_helper.py, because it leaves backend.usage_v2.helper patched for the rest
of the test run. Move the FakeUsage substitution into a test fixture or
monkeypatch setup/teardown so helper_mod.Usage is only overridden within the
scope of each test, while keeping get_usage_by_model and UsageHelper as the
relevant symbols to target.

In `@tests/rig/cli.py`:
- Around line 680-683: The project-root editable install in the CLI test setup
is redundant because uv run already installs the current project editable, so
the install_editable flag is not actually controlling behavior for unit-core.
Update the logic around group.install_editable in cli.py so it does not
unconditionally add --with-editable str(workdir) for the project root; instead,
either remove this branch or switch to the appropriate uv flags (--no-project or
--no-editable) if the flag is intended to control project installation.

In `@unstract/connectors/tests/databases/test_redshift_db.py`:
- Around line 8-18: The Redshift integration test only skips when
REDSHIFT_TEST_PASSWORD is set, but test_user_name_and_password still directly
requires REDSHIFT_TEST_HOST through os.environ[], so the test can fail instead
of skipping. Update the unittest.skipUnless guard on test_user_name_and_password
in test_redshift_db.py to require all mandatory Redshift env vars used by
Redshift initialization, especially REDSHIFT_TEST_PASSWORD and
REDSHIFT_TEST_HOST, so the test is skipped unless every required setting is
present.

In `@unstract/connectors/tests/databases/test_snowflake_db.py`:
- Around line 8-21: Update the test guard in test_snowflake_db.py so the
Snowflake integration test is skipped unless all required mandatory environment
variables are set, not just SNOWFLAKE_TEST_PASSWORD. In test_something, adjust
the `@unittest.skipUnless` condition to check the presence of SNOWFLAKE_TEST_USER,
SNOWFLAKE_TEST_PASSWORD, and SNOWFLAKE_TEST_ACCOUNT before constructing
SnowflakeDB, while keeping the optional defaults for database, schema,
warehouse, and role unchanged.

In `@unstract/connectors/tests/filesystems/test_google_drive_fs.py`:
- Around line 8-10: The Google Drive integration test is only gated on
GDRIVE_GOOGLE_SERVICE_ACCOUNT, so it can still run and fail when the Google
Drive environment is only partially configured. Update the unittest.skipUnless
condition in test_google_drive_fs to require the full Google Drive env contract
used by GoogleDriveFS initialization, including both
GDRIVE_GOOGLE_SERVICE_ACCOUNT and GDRIVE_GOOGLE_PROJECT_ID, so the test is
skipped unless all required settings are present.

In `@unstract/connectors/tests/filesystems/test_miniofs.py`:
- Around line 35-37: The MinIO integration test skip guard only checks
MINIO_ACCESS_KEY_ID, so it can still run without MINIO_SECRET_ACCESS_KEY and
fail later. Update the skip condition in test_miniofs.py around the
unittest.skipUnless on the MinioFSTest class to require both MINIO_ACCESS_KEY_ID
and MINIO_SECRET_ACCESS_KEY before running, so the test cleanly skips unless a
usable MinIO client can be built.

In `@unstract/connectors/tests/filesystems/test_pcs.py`:
- Around line 8-10: The PCS integration test gating is incomplete because it
only checks GOOGLE_STORAGE_ACCESS_KEY_ID while the test setup also depends on
GOOGLE_STORAGE_SECRET_ACCESS_KEY. Update the skip condition in the test
decorator for the PCS test in test_pcs.py so it skips unless both credentials
are present, using the existing unittest.skipUnless on the test class or method
that configures the PCS client.

---

Nitpick comments:
In `@unstract/connectors/tests/filesystems/test_sharepoint_fs.py`:
- Around line 118-122: The SharePoint filesystem test is skipped instead of
asserting the intended schema contract, so replace the skip in
test_sharepoint_fs.py with an explicit assertion in the relevant test around
is_personal/json_schema.json behavior. Use the existing SharePoint filesystem
test class and helpers to verify that is_personal is intentionally absent from
the JSON schema (and that personal/site is inferred from site_url), so future
schema drift is caught by the test instead of being ignored.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3ead960d-5f5a-4850-8f85-5e9cb6850294

📥 Commits

Reviewing files that changed from the base of the PR and between 63e53ff and d55768c.

⛔ Files ignored due to path filters (1)
  • backend/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (22)
  • backend/dashboard_metrics/tests/test_tasks.py
  • backend/prompt_studio/prompt_studio_core_v2/tests/test_build_index_payload.py
  • backend/pyproject.toml
  • backend/usage_v2/tests/test_helper.py
  • backend/utils/file_storage/__init__.py
  • backend/utils/file_storage/helpers/__init__.py
  • backend/utils/file_storage/helpers/prompt_studio_file_helper.py
  • pyproject.toml
  • tests/groups.yaml
  • tests/rig/cli.py
  • unstract/connectors/tests/databases/test_mariadb.py
  • unstract/connectors/tests/databases/test_mssql_db.py
  • unstract/connectors/tests/databases/test_mysql_db.py
  • unstract/connectors/tests/databases/test_postgresql_db.py
  • unstract/connectors/tests/databases/test_redshift_db.py
  • unstract/connectors/tests/databases/test_snowflake_db.py
  • unstract/connectors/tests/filesystems/test_box_fs.py
  • unstract/connectors/tests/filesystems/test_google_drive_fs.py
  • unstract/connectors/tests/filesystems/test_miniofs.py
  • unstract/connectors/tests/filesystems/test_pcs.py
  • unstract/connectors/tests/filesystems/test_sharepoint_fs.py
  • unstract/connectors/tests/filesystems/test_zs_dropbox_fs.py
💤 Files with no reviewable changes (1)
  • pyproject.toml
✅ Files skipped from review due to trivial changes (2)
  • backend/utils/file_storage/helpers/prompt_studio_file_helper.py
  • unstract/connectors/tests/databases/test_mariadb.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/groups.yaml

Comment thread backend/prompt_studio/prompt_studio_core_v2/tests/test_build_index_payload.py Outdated
Comment thread backend/usage_v2/tests/test_helper.py Outdated
Comment thread tests/rig/cli.py Outdated
Comment thread unstract/connectors/tests/databases/test_redshift_db.py Outdated
Comment thread unstract/connectors/tests/databases/test_snowflake_db.py Outdated
Comment thread unstract/connectors/tests/filesystems/test_google_drive_fs.py Outdated
Comment thread unstract/connectors/tests/filesystems/test_miniofs.py Outdated
Comment thread unstract/connectors/tests/filesystems/test_pcs.py Outdated
chandrasekharan-zipstack and others added 9 commits June 30, 2026 15:36
… main runs green

The rig's unit/integration CI job had never passed on main. `--fail-on-critical-gap`
(passed only on the main push) failed the build on EVERY uncovered critical path,
including e2e-only paths run during the unit/integration tier and paths with no test
anywhere. Every group-level failure was already non-gating (optional groups, or exit
5 = no tests collected), so the gap gate was the sole cause of redness.

- Split critical-path gaps into in-scope vs out-of-scope (add `in_scope` to
  CriticalPathStatus; evaluate() already computed it). --fail-on-critical-gap now
  gates only on in-scope gaps — a declared in-tier covering group that didn't run
  green (real coverage regressed). Out-of-scope gaps (covered only by an unrun tier,
  or no declared coverage) are reported + logged but never gate that tier.
- Wire honest coverage that exists today: adapter-register-llm -> unit-sdk1. Gives
  the path teeth: if sdk1 regresses, it flips to an in-scope gap and fails.
- Drop unit-tool-registry group (component slated for removal; can't even collect).
- Delete 3 dead tests referencing removed code: core test_pandora_account.py
  (account_services removed), core test_pubsub_helper.py (LogHelper -> LogPublisher),
  platform-service test_auth_middleware.py (platform_service.main removed; also made
  live Postgres calls). unit-platform-service is green via its hermetic memory-leak
  test; unit-core has no valid tests left and skips as a placeholder.

New self-tests cover the in-scope/out-of-scope split at both evaluate() and cmd_run().

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XJqp7xMdd1kjLUKbvrJsq4
…kend tests

Follow-up cleanup on the rig manifests (UN-3636):

- Park unit-runner and unit-prompt-service (commented out, not run by
  default) with a TODO to delete when those services are removed — both are
  being decommissioned; no value testing components on their way out.
- Drop the unit-tool-registry NOTE block entirely.
- Prune 6 unit-backend paths that collect zero tests (account_v2,
  api_deployment_v2, connector_v2, file_management, project,
  tenant_account_v2 — dirs missing or empty); optional skip-if-missing was
  hiding them and implying coverage that was never written.
- Wire two real backend tests into unit-backend:
    * middleware/test_exception.py — 5 hermetic tests, pass now.
    * prompt_studio/prompt_studio_core_v2/tests — pins the executor
      _handle_ide_index async path (no prompt-service coupling); runs once
      unit-backend is un-gated, skips safely until then.
- Comment out the tool-sandbox-exec critical path (TODO: remove with
  tool-registry/runner) — its covering group unit-runner is now parked.

`python -m tests.rig validate` → OK (13 groups, 9 critical paths).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
…jango setting

unit-core ran 0 tests / 2 collection errors (ModuleNotFoundError: No module
named 'unstract'). Root cause: _prepare_group_env did `uv pip install -e .`
for install_editable groups, but _pytest_command runs `uv run`, which
re-syncs the venv every call and wipes that install before pytest imports the
package — the same hazard the code already flagged for plugins.

Inject the package via `uv run --with-editable <workdir>` (survives the
re-sync, same mechanism as the RIG_PYTEST_PLUGINS `--with` specs) and drop the
wiped `uv pip install -e .`. unit-core now 27 passed, 0 errors.

Also remove DJANGO_SETTINGS_MODULE from the repo-root [tool.pytest.ini_options]:
it's a pytest-django option that warns "Unknown config option" for every
non-Django group, points at a non-existent module (backend.settings.test_cases),
and Django settings don't belong at the polyglot repo root. The rig injects it
per-group via groups.yaml env for unit-backend only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
The unit-backend group pointed at a non-existent settings module
(backend.settings.test_cases) and ran without pytest-django, so the
DB-backed tests errored at collection (Django uninitialised) and the
django_db tests had no test-DB lifecycle. Make the group actually runnable:

- Add pytest-django to the backend test group (bootstraps Django before
  collection; provides the test-DB + django_db fixtures).
- Point DJANGO_SETTINGS_MODULE at the existing backend.settings.test and
  inject the import-time-required settings via the group env — base.py reads
  them before any dotenv load, so they must exist in the process env, not a
  settings module. ENCRYPTION_KEY is an all-zero (valid, zero-entropy) Fernet
  placeholder, not a real secret.
- Set DB_SCHEMA=public: the app's fixed schema doesn't exist in the fresh
  test DB and tenancy is row-level, so migrations run in public.
- Drop workflow_manager/endpoint_v2/tests from the wired paths: its
  destination-connector tests import the enterprise `plugins` package,
  absent in OSS.
- Add the missing utils/file_storage{,/helpers}/__init__.py so those
  modules import as a package under pytest.
- Stop test_build_index_payload's sys.modules stubs from leaking into
  sibling collection: record + restore the originals once the helper is
  imported (a stubbed account_v2.models was breaking other modules'
  real imports).

unit-backend now collects clean; 126 passed, 4 skipped. The remaining 6
failures (usage_v2 helper stubs, dashboard_metrics cleanup tasks) are
pre-existing test bugs tracked separately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
dashboard_metrics: organization FK targets Organization's int PK, but the
tests passed a UUID string as organization_id, and verified rows through
the org-scoped default manager (empty without a UserContext). Create a
real Organization and read via _base_manager.

usage_v2: drop the fragile "stub usage_v2.models into sys.modules before
import" trick — under pytest-django Django imports the real module first,
so the stub never took and the helper hit the DB. Rebind the Usage symbol
the helper resolved instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
The connector suite had 12 reds that needed real external services or
per-developer credentials no one has by default. Two were genuine bugs;
the rest are integration tests masquerading as unit tests.

Fixes (not credential-related):
- mariadb: assertion text drifted from the connector's actual message
  ("SSL SETTINGS", not "ssl-settings").
- sharepoint: skip test_json_schema_has_is_personal — is_personal is read
  from settings in code but was never exposed in json_schema.json (personal
  vs site is inferred from an empty site_url). Whether the schema should
  expose it is a product decision; tracked under UN-3414.

Gating (skipUnless, mirrors the existing SharePoint integration tests):
- filesystems (box, gdrive, minio, pcs, dropbox) already read creds from
  env; add the missing skip guard so they SKIP instead of failing.
- databases (mssql, mysql, postgresql, redshift, snowflake) had hardcoded
  personal creds (incl. a live-looking neon.tech URL and a Snowflake
  account) querying bespoke tables. Move creds to *_TEST_* env vars and
  skip unless provided, removing the secrets from the repo.

CI can run these by injecting the corresponding secrets as env vars in a
dedicated integration job; by default they skip cleanly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
Both now run green and standalone (no external services; integration
tests skip cleanly when credentials are absent), so drop optional: true
to make them blocking merge gates per UN-3635.

unit-backend stays optional until the rig provisions a reachable DB_HOST
for it (UN-3636 follow-up).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
- in_scope defaults False on CriticalPathStatus so a future evaluate()
  regression that forgets it under-gates (warning) rather than over-gates
  (spurious build block). [greptile]
- widen connector integration skip guards (redshift, snowflake, gdrive,
  minio, pcs) to require every env var the test hard-references, so a
  partially configured env skips cleanly instead of failing. [coderabbit]
- usage_v2 test_helper: swap Usage via an autouse monkeypatch fixture
  instead of a module-level rebind that leaks FakeUsage into later tests.
- build_index_payload test: evict the helper module from sys.modules after
  binding it, so later importers in the same process get a real copy.
- drop dead tox `runner` alias (its unit-runner group was removed).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tox.ini`:
- Line 12: Update the stale alias comment in tox config so it no longer mentions
the removed runner env. Adjust the comment near the existing service envs to
reflect only the envs that still exist, using the same nearby tox env names as
the reference point so the documentation matches the current configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dfe7f820-870a-4a7a-b39f-ba9b196dc4cf

📥 Commits

Reviewing files that changed from the base of the PR and between d55768c and 9e04f44.

⛔ Files ignored due to path filters (1)
  • backend/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (30)
  • backend/dashboard_metrics/tests/test_tasks.py
  • backend/prompt_studio/prompt_studio_core_v2/tests/test_build_index_payload.py
  • backend/pyproject.toml
  • backend/usage_v2/tests/test_helper.py
  • backend/utils/file_storage/__init__.py
  • backend/utils/file_storage/helpers/__init__.py
  • backend/utils/file_storage/helpers/prompt_studio_file_helper.py
  • platform-service/tests/test_auth_middleware.py
  • pyproject.toml
  • tests/critical_paths.yaml
  • tests/groups.yaml
  • tests/rig/cli.py
  • tests/rig/critical_paths.py
  • tests/rig/tests/test_cli.py
  • tests/rig/tests/test_critical_paths.py
  • tox.ini
  • unstract/connectors/tests/databases/test_mariadb.py
  • unstract/connectors/tests/databases/test_mssql_db.py
  • unstract/connectors/tests/databases/test_mysql_db.py
  • unstract/connectors/tests/databases/test_postgresql_db.py
  • unstract/connectors/tests/databases/test_redshift_db.py
  • unstract/connectors/tests/databases/test_snowflake_db.py
  • unstract/connectors/tests/filesystems/test_box_fs.py
  • unstract/connectors/tests/filesystems/test_google_drive_fs.py
  • unstract/connectors/tests/filesystems/test_miniofs.py
  • unstract/connectors/tests/filesystems/test_pcs.py
  • unstract/connectors/tests/filesystems/test_sharepoint_fs.py
  • unstract/connectors/tests/filesystems/test_zs_dropbox_fs.py
  • unstract/core/tests/account_services/test_pandora_account.py
  • unstract/core/tests/test_pubsub_helper.py
💤 Files with no reviewable changes (4)
  • unstract/core/tests/account_services/test_pandora_account.py
  • platform-service/tests/test_auth_middleware.py
  • unstract/core/tests/test_pubsub_helper.py
  • pyproject.toml
✅ Files skipped from review due to trivial changes (3)
  • backend/utils/file_storage/helpers/prompt_studio_file_helper.py
  • unstract/connectors/tests/filesystems/test_google_drive_fs.py
  • unstract/connectors/tests/filesystems/test_box_fs.py
🚧 Files skipped from review as they are similar to previous changes (15)
  • unstract/connectors/tests/databases/test_mariadb.py
  • unstract/connectors/tests/databases/test_mysql_db.py
  • unstract/connectors/tests/filesystems/test_miniofs.py
  • unstract/connectors/tests/databases/test_postgresql_db.py
  • unstract/connectors/tests/filesystems/test_sharepoint_fs.py
  • unstract/connectors/tests/databases/test_snowflake_db.py
  • tests/rig/tests/test_critical_paths.py
  • unstract/connectors/tests/databases/test_mssql_db.py
  • tests/rig/tests/test_cli.py
  • backend/prompt_studio/prompt_studio_core_v2/tests/test_build_index_payload.py
  • unstract/connectors/tests/databases/test_redshift_db.py
  • tests/critical_paths.yaml
  • unstract/connectors/tests/filesystems/test_zs_dropbox_fs.py
  • backend/usage_v2/tests/test_helper.py
  • backend/dashboard_metrics/tests/test_tasks.py

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tox.ini`:
- Line 12: Update the stale alias comment in tox config so it no longer mentions
the removed runner env. Adjust the comment near the existing service envs to
reflect only the envs that still exist, using the same nearby tox env names as
the reference point so the documentation matches the current configuration.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: dfe7f820-870a-4a7a-b39f-ba9b196dc4cf

📥 Commits

Reviewing files that changed from the base of the PR and between d55768c and 9e04f44.

⛔ Files ignored due to path filters (1)
  • backend/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (30)
  • backend/dashboard_metrics/tests/test_tasks.py
  • backend/prompt_studio/prompt_studio_core_v2/tests/test_build_index_payload.py
  • backend/pyproject.toml
  • backend/usage_v2/tests/test_helper.py
  • backend/utils/file_storage/__init__.py
  • backend/utils/file_storage/helpers/__init__.py
  • backend/utils/file_storage/helpers/prompt_studio_file_helper.py
  • platform-service/tests/test_auth_middleware.py
  • pyproject.toml
  • tests/critical_paths.yaml
  • tests/groups.yaml
  • tests/rig/cli.py
  • tests/rig/critical_paths.py
  • tests/rig/tests/test_cli.py
  • tests/rig/tests/test_critical_paths.py
  • tox.ini
  • unstract/connectors/tests/databases/test_mariadb.py
  • unstract/connectors/tests/databases/test_mssql_db.py
  • unstract/connectors/tests/databases/test_mysql_db.py
  • unstract/connectors/tests/databases/test_postgresql_db.py
  • unstract/connectors/tests/databases/test_redshift_db.py
  • unstract/connectors/tests/databases/test_snowflake_db.py
  • unstract/connectors/tests/filesystems/test_box_fs.py
  • unstract/connectors/tests/filesystems/test_google_drive_fs.py
  • unstract/connectors/tests/filesystems/test_miniofs.py
  • unstract/connectors/tests/filesystems/test_pcs.py
  • unstract/connectors/tests/filesystems/test_sharepoint_fs.py
  • unstract/connectors/tests/filesystems/test_zs_dropbox_fs.py
  • unstract/core/tests/account_services/test_pandora_account.py
  • unstract/core/tests/test_pubsub_helper.py
💤 Files with no reviewable changes (4)
  • unstract/core/tests/account_services/test_pandora_account.py
  • platform-service/tests/test_auth_middleware.py
  • unstract/core/tests/test_pubsub_helper.py
  • pyproject.toml
✅ Files skipped from review due to trivial changes (3)
  • backend/utils/file_storage/helpers/prompt_studio_file_helper.py
  • unstract/connectors/tests/filesystems/test_google_drive_fs.py
  • unstract/connectors/tests/filesystems/test_box_fs.py
🚧 Files skipped from review as they are similar to previous changes (15)
  • unstract/connectors/tests/databases/test_mariadb.py
  • unstract/connectors/tests/databases/test_mysql_db.py
  • unstract/connectors/tests/filesystems/test_miniofs.py
  • unstract/connectors/tests/databases/test_postgresql_db.py
  • unstract/connectors/tests/filesystems/test_sharepoint_fs.py
  • unstract/connectors/tests/databases/test_snowflake_db.py
  • tests/rig/tests/test_critical_paths.py
  • unstract/connectors/tests/databases/test_mssql_db.py
  • tests/rig/tests/test_cli.py
  • backend/prompt_studio/prompt_studio_core_v2/tests/test_build_index_payload.py
  • unstract/connectors/tests/databases/test_redshift_db.py
  • tests/critical_paths.yaml
  • unstract/connectors/tests/filesystems/test_zs_dropbox_fs.py
  • backend/usage_v2/tests/test_helper.py
  • backend/dashboard_metrics/tests/test_tasks.py
🛑 Comments failed to post (1)
tox.ini (1)

12-12: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update the stale alias comment.

runner was removed in this change, so this comment now documents a tox env that no longer exists.

Suggested diff
-# Pre-existing service envs (runner, sdk1) remain as thin
+# Pre-existing service envs (sdk1) remain as thin
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

# Pre-existing service envs (sdk1) remain as thin
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tox.ini` at line 12, Update the stale alias comment in tox config so it no
longer mentions the removed runner env. Adjust the comment near the existing
service envs to reflect only the envs that still exist, using the same nearby
tox env names as the reference point so the documentation matches the current
configuration.

… out of unit

Make `requires_services` actually provision instead of being cosmetic. The rig
now brings up testcontainers infra (Postgres/MinIO) for any runnable group that
declares `requires_services`, and injects connection env into the group's pytest
subprocess (Postgres URL -> discrete DB_* vars; MinIO endpoint/creds). Previously
django_db tests fell back to the compose hostname `backend-db-1`, unreachable
from host-side pytest, so unit-backend had to be `optional`.

Reclassify infra-dependent tests by the rig's own tier taxonomy (unit = no
external services, integration = real infra but not the full platform):

- backend: split unit-backend into pure `unit-backend` (gates unit tier, no
  infra) and `integration-backend` (django_db tests: dashboard_metrics +
  prompt_studio_registry_v2; provisioned Postgres; gates integration tier).
- connectors: marker-based split (tests are interleaved within files). Credential
  + MinIO tests marked `@pytest.mark.integration`; `unit-connectors` runs
  `-m "not integration"`, new `integration-connectors` runs `-m "integration"`.
  test_minio actually runs against provisioned MinIO; external-credential tests
  skip. Skip-guard test_http_fs (was hitting a live URL unguarded in CI).

Both groups are non-optional and gate their tiers. Unit tier stays infra-free.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
Comment thread tests/rig/tests/test_cli.py Fixed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/rig/cli.py`:
- Around line 611-631: The backend env override logic in cli.py only applies
Postgres and MinIO, so Redis-backed groups still use the default localhost Redis
and miss the provisioned endpoint. Update the same env-building block that
handles endpoints.infra.postgres_url and endpoints.infra.minio_endpoint to also
check for the Redis service requirement and, when present, rewrite the Redis
connection env from the provisioned Redis endpoint instead of leaving the
tests/groups.yaml default in place. Use the existing endpoint pattern and the
group.requires_services check so integration-backend and other Redis-backed
groups pick up the testcontainer Redis consistently.

In `@unstract/connectors/tests/filesystems/test_http_fs.py`:
- Around line 1-15: Mark the HttpFS test module as integration-tier so it is
selected by the integration test job and excluded from unit runs. Update the
TestHttpFS module/class in the HTTP filesystem test file to use the integration
marker already used elsewhere in the test suite, while keeping the existing
HTTP_FS_TEST_URL skip guard for the live-server dependency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: bac488a0-d4b9-4736-96ba-2a98e93b06c7

📥 Commits

Reviewing files that changed from the base of the PR and between 9e04f44 and 674fe8a.

📒 Files selected for processing (17)
  • tests/groups.yaml
  • tests/rig/cli.py
  • tests/rig/runtime.py
  • tests/rig/tests/test_cli.py
  • unstract/connectors/pyproject.toml
  • unstract/connectors/tests/databases/test_mssql_db.py
  • unstract/connectors/tests/databases/test_mysql_db.py
  • unstract/connectors/tests/databases/test_postgresql_db.py
  • unstract/connectors/tests/databases/test_redshift_db.py
  • unstract/connectors/tests/databases/test_snowflake_db.py
  • unstract/connectors/tests/filesystems/test_box_fs.py
  • unstract/connectors/tests/filesystems/test_google_drive_fs.py
  • unstract/connectors/tests/filesystems/test_http_fs.py
  • unstract/connectors/tests/filesystems/test_miniofs.py
  • unstract/connectors/tests/filesystems/test_pcs.py
  • unstract/connectors/tests/filesystems/test_sharepoint_fs.py
  • unstract/connectors/tests/filesystems/test_zs_dropbox_fs.py
🚧 Files skipped from review as they are similar to previous changes (10)
  • unstract/connectors/tests/filesystems/test_miniofs.py
  • unstract/connectors/tests/filesystems/test_sharepoint_fs.py
  • unstract/connectors/tests/filesystems/test_box_fs.py
  • unstract/connectors/tests/filesystems/test_google_drive_fs.py
  • unstract/connectors/tests/databases/test_mysql_db.py
  • unstract/connectors/tests/databases/test_mssql_db.py
  • unstract/connectors/tests/databases/test_snowflake_db.py
  • unstract/connectors/tests/databases/test_postgresql_db.py
  • unstract/connectors/tests/filesystems/test_zs_dropbox_fs.py
  • unstract/connectors/tests/databases/test_redshift_db.py

Comment thread tests/rig/cli.py Outdated
Comment thread unstract/connectors/tests/filesystems/test_http_fs.py
…ation, cut rig complexity

- integration-backend declares requires_services: [postgres, redis] but the rig
  only injected Postgres/MinIO env, so Redis-backed tests bypassed the
  testcontainer and hit localhost:6379. Inject REDIS_HOST/PORT +
  CELERY_BROKER_BASE_URL from the provisioned endpoint (CodeRabbit).
- test_http_fs was skip-guarded but unmarked, so the connector marker split
  (-m "not integration") could still run it in the unit tier. Mark the module
  integration (CodeRabbit).
- Extract _inject_infra_env and _pytest_base_cmd to bring both functions under
  SonarCloud's cognitive-complexity threshold. NOSONAR the test's DB_PASSWORD
  placeholder (not a real credential).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
Comment thread tests/rig/tests/test_cli.py Fixed
Comment thread tests/rig/tests/test_cli.py Fixed
Comment thread tests/rig/tests/test_cli.py Fixed
chandrasekharan-zipstack and others added 5 commits July 1, 2026 10:54
The MinIO endpoint is a throwaway testcontainer with no TLS, so http is
expected. Suppress the SonarCloud insecure-protocol hotspot that otherwise
blocks the quality gate on new code.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
The module stubs adapter_processor_v2.models to import PromptStudioHelper
without the full Django app, but only provided AdapterInstance. The helper
also imports UserDefaultAdapter, so the import failed and all 4 tests in the
module self-skipped via the _IMPORT_ERROR guard. Add the missing stub so the
tests actually execute.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
Removed from the e2e test overlay; the platform brought up for e2e no longer
provisions a standalone prompt-service.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
…r tests

- test_miniofs: drop the permanently-skipped test_s3 (hardcoded AWS S3 smoke).
  MinIO/S3 is covered by test_minio (integration), the TestAccessFilteredS3
  unit tests, and the connectorkit registry check.
- database + filesystem tests: replace print()-in-loop debug with assertions
  (or drop redundant prints) so integration runs don't spam the logs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C5HQX5CSoMR6RzHtXcfwJt
@chandrasekharan-zipstack chandrasekharan-zipstack changed the title UN-3636 [FIX] Scope rig --fail-on-critical-gap to in-tier coverage so main runs green UN-3636 [FIX] Make the rig unit/integration CI job green on main Jul 2, 2026
@chandrasekharan-zipstack chandrasekharan-zipstack changed the title UN-3636 [FIX] Make the rig unit/integration CI job green on main UN-3636 [MISC] Make the rig unit/integration CI job green on main Jul 2, 2026
chandrasekharan-zipstack and others added 9 commits July 7, 2026 11:19
…connector_v2 tests

- groups.yaml: integration-backend now selects paths ["."] with -m integration
  — the exact complement of unit-backend over the same tree. New backend DB
  tests auto-join the group with no manifest edit. Verified equivalent:
  collect-only shows the same 50/166 tests (116 deselected); full run against
  testcontainers Postgres/Redis gives the same 24 passed / 26 skipped as the
  hand-listed paths on CI.
- Delete backend/connector_v2/tests (connector_tests.py, conftest.py, fixture):
  written for the pre-v2 schema — the fixture loads removed models
  (account.org, account.user, project) so loaddata errors immediately, and the
  filename never matched pytest's test_*.py pattern, so these tests have not
  been collected anywhere. Same dead-test cleanup as the rest of this branch.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
The previous version stubbed cross-app imports in sys.modules (only when
absent) — written for a bare no-Django env. Under the rig, pytest-django
boots Django and the real modules are already imported, so the stubs were
skipped and the tests called reset_mock() on real classes (AttributeError).

Same control-flow assertions, now via mock.patch.multiple on the imported
module: no sys.modules mutation, no import-order dependence, safe in a
shared pytest session. Stays in the unit tier (no DB touched).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
…ss flask check

- test_build_index_payload.py: import the real prompt_studio_helper (Django is
  loaded by the rig env) instead of installing ~30 stub modules in sys.modules
  and restoring them post-import. The clobber/restore dance was import-order
  dependent and silently skipped all tests when the stub surface drifted.
  Tests and assertions unchanged; patches now managed via ExitStack.
- test_legacy_executor_scaffold.py: test_no_flask_import now runs the check in
  a fresh subprocess. The in-place importlib.reload swapped class identities
  under sibling tests, and scanning sys.modules in-process fails if any other
  test imported flask.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
…compat

Trigger-level paths-ignore means docs/frontend/docker-only PRs never start
the workflow, so no check run is created and a required 'test' status check
would block those PRs forever. A 'changes' job now always runs and gates
'test' via needs + if; a skipped job still reports a check run (skipped =
passing for required checks), while any executed test failure still fails.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TGcZHkM4jbUmrx4YNYewZK
…guard test

- python_files = [test_*.py, *_test.py, *_tests.py] in backend, workers, sdk1,
  connectors — one superset everywhere instead of three different configs.
  sdk1 loses the unused bare tests.py pattern (no such files). No currently
  existing file changes collection status (verified: zero *_tests.py in repo).
- Remove test_no_flask_import: flask is not a workers dependency, so a flask
  import in the exceptions module would already fail every test that imports
  it; the Flask source it guarded against (prompt-service) is decommissioned.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
Accepting the bare `tests.py` Django convention surfaces two real backend
suites (tenant_account_v2, account_v2 — 28 tests) that were written but
never collected. All pass in integration-backend (24→52 passed, skips
unchanged); unit-backend collection is untouched.

Bare `test.py` is deliberately NOT accepted: backend/backend/settings/test.py
is a Django settings module and would be imported as a test module.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
The tiers share no state (separate runners, disjoint groups), so they run
as matrix legs; wall clock drops from tier-sum to max(tiers). Everything
needing both tiers' results moves to a new `report` job fed by per-tier
artifacts: report aggregation, coverage union (tier .coverage files are
suffixed so `coverage combine` can merge them), PR comment, and the
main-branch baseline.

Baseline writes were the one real conflict: parallel per-tier
`run --update-baseline` would race the cache save (first save wins, the
other tier's coverage is lost). Tier jobs now restore-only; the rig's
`report combine` gains `--update-baseline` as the single writer, refusing
the merge when any non-optional group is red or the baseline is corrupt.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
chandrasekharan-zipstack and others added 5 commits July 7, 2026 17:15
Lets `report` serve as the single required branch-protection check: a
matrix job's result is success only when every leg passes, so either
tier failing turns report red too.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
Trim verbose comments and drop PR-narrative phrasing that would go stale.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
Critical-path regressions already gate PRs; the gap check was main-only
to avoid failing unrelated PRs on pre-existing debt. With main enforced
gap-free and PR CI running the merge ref, a gap failure on a PR can only
be one the PR introduces — so catch it before merge, not after.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
`branches: [main]` filters by base branch, so stacked PRs (targeting a
feature branch) got no test runs at all until the stack reached main.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU

@ritwik-g ritwik-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Focused review of the rig/CI changes. All items below were verified against the branch; I've skipped everything the bots already resolved. Nothing here blocks the core approach (which is sound) — one is an operational merge step, one is a latent gate hole this PR widens, and two are coverage-loss judgment calls on deletions.

Comment thread .github/workflows/ci-test.yaml
Comment thread .github/workflows/ci-test.yaml Outdated
Comment thread tests/rig/cli.py Outdated
Comment thread unstract/connectors/tests/databases/test_bigquery_db.py

@ritwik-g ritwik-g left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving. This touches no production runtime code, and the core approach — gate scoping to in-tier coverage, marker-based unit/integration split via the central conftest auto-marker, testcontainers provisioning for the integration tier, and the parallel matrix CI + single-writer baseline — is sound and verified green.

One merge-time step (not a code change): the required status check must be repointed when this lands. test becomes a matrix, so the old test context stops reporting — require the report job (or both test (unit) / test (integration)) or PRs will hang on a missing check. Handled at merge.

Non-blocking follow-ups from the inline comments:

  • Restore the two mock-only connector tests (test_bigquery_db.py, test_mariadb.py) — they aren't actually superseded by the Postgres-only backend tests.
  • Track the empty-counts-as-coverage-green gate hole (latent) and the data=None'None' jsonb error-path bug that the removed Postgres test covered.

None of these block the merge; they can be handled as fast-follows.

chandrasekharan-zipstack and others added 3 commits July 8, 2026 10:51
… coverage

Review feedback on the rig's coverage attestation: a covering group that
collected zero tests (pytest exit 5) counted as green for critical-path
coverage, so marker drift in a marker-only group like integration-backend
could bake false coverage into the baseline. Two changes close this:

- Coverage attestation now requires status == "pass"; "empty" stays
  non-failing for the build but proves nothing.
- New `proof: marker` per path in critical_paths.yaml: on top of a green
  covering group, the path needs >=1 passing test carrying
  @pytest.mark.critical_path("<id>") in that build. A rig-injected pytest
  plugin (PYTHONPATH + -p, junit_family=legacy) copies marker args into
  junit testcase properties; the rig reads back only passing testcases.
  Tests may stack multiple markers. Unknown marker ids fail the run so a
  typo can't silently attest nothing.

adapter-register-llm is flipped to proof: marker and its API test marked —
deleting that test now drops the path to regression instead of hiding
behind the rest of integration-backend staying green. Other paths stay
proof: group until their tests are backfilled and marked.

Verified: rig self-tests 64 passed; integration-backend via testcontainers
52 passed / 26 skipped / 1 xfailed with adapter-register-llm reported
covered via the junit marker property (under xdist).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
…t on broken changes job

Address remaining PR review findings:

- Restore test_bigquery_db.py and test_mariadb.py: unlike the five
  live-DB smoke tests deleted alongside them, these are pure mock-based
  unit tests that ran green in CI and were the only coverage of BigQuery's
  Forbidden/NotFound exception mapping and MariaDB's SSL-param build +
  1045/2003 message mapping. They rejoin unit-connectors (unmarked).

- Restore test_insert_into_db_with_error_postgresql as strict xfail: it
  exercises a real shipping bug (get_sql_values_for_query serializes
  data=None as the literal string 'None', invalid JSON for the jsonb
  column) that deleting the test papered over. The xfail keeps the error
  path exercised in CI and flips loudly when the bug is fixed.

- ci-test.yaml: the report job now also needs `changes` and runs whenever
  changes did not succeed. Previously a failed changes job (checkout or
  paths-filter flake) skipped test -> skipped report -> the required check
  passed green with zero tests run. Skip remains only for a legitimate
  skip decided by a successful changes job (irrelevant paths / draft).

Verified: integration-backend via testcontainers reports the restored
error test as xfailed; unit-connectors 63 passed (+10 from the restored
files).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
- Extract per-path classification out of evaluate() to cut cognitive
  complexity (S3776)
- Drop unused config param from pytest_collection_modifyitems; pytest
  matches hook args by name (S1172)
- Use a real GroupManifest in the marker-proof validation test instead
  of a duck-typed stub (S5655)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Unstract test results

Per-group results

Status Group Tier Passed Failed Errors Skipped Duration (s)
integration-backend integration 56 0 0 27 47.8
integration-connectors integration 1 0 0 7 8.7
unit-backend unit 118 0 0 0 14.9
unit-connectors unit 63 0 0 0 9.3
unit-core unit 27 0 0 0 0.9
unit-platform-service unit 9 0 0 0 1.0
unit-rig unit 69 0 0 0 2.7
unit-sdk1 unit 381 0 0 0 20.7
unit-workers unit 0 0 0 0 21.7
TOTAL 724 0 0 34 127.8

Critical paths

⚠️ Critical paths not yet covered

  • auth-login — User can log in and obtain a session cookie. (entry: POST /api/v1/auth/login; declared coverage: no groups declared)
  • workflow-create-execute — Create a workflow, configure source+destination, execute, poll, fetch result. (entry: POST /api/v1/workflow/{id}/execute/; declared coverage: e2e-workflow)
  • api-deployment-run — Deploy a workflow as an API, POST a document, receive structured JSON. (entry: POST /deployment/api/{org}/{name}/; declared coverage: e2e-api-deployment)
  • prompt-studio-fetch-response — Prompt Studio: create project, add prompt, run single-pass, get response. (entry: POST /api/v1/prompt-studio/prompt-studio-tool/{id}/fetch_response/; declared coverage: e2e-prompt-studio)
  • pipeline-etl-execute — Run an ETL pipeline from source connector to destination. (entry: POST /api/v1/pipeline/{id}/execute/; declared coverage: no groups declared)
  • usage-token-tracking — Per-execution token usage is recorded and retrievable. (entry: GET /api/v1/usage/get_token_usage/; declared coverage: no groups declared)
  • workflow-execution-fan-out — Multi-file workflow execution fans out to file-processing workers and rejoins. (entry: internal: backend → rabbitmq → workers/file_processing; declared coverage: no groups declared)
  • callback-result-delivery — Async results are posted back via the callback worker. (entry: internal: workers/callback → backend /internal endpoints; declared coverage: no groups declared)
✅ Covered critical paths
  • adapter-register-llm — covered by integration-backend

@chandrasekharan-zipstack chandrasekharan-zipstack merged commit 913bb6a into main Jul 8, 2026
13 checks passed
@chandrasekharan-zipstack chandrasekharan-zipstack deleted the fix/test-rig-green-v2 branch July 8, 2026 07:54
chandrasekharan-zipstack added a commit that referenced this pull request Jul 8, 2026
test_no_flask_import, the test_miniofs comment, and the groups.yaml Fernet
comment were intentionally dropped or shortened in #2115; keep main's version
rather than the e2e branch's re-additions.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017UVfw7aAocC3KCJaEyZ5GU
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants